package com.iRomantic.common;


/**
 * json响应
 * @author serenity
 *
 */
public class AppJsonResponse {
	
	/**
     * error msg.
     */
    private static final String ERROR_MSG = "errorMessage";

    /**
     * error stack.
     */
    private static final String ERROR_STACK = "errorStack";
    
    /**
     * 成功代码
     */
    private static final String SUCCESS_MSG = "success";
    
    /**
     * 成功
     */
    private static final int SUCCESS = 1;
    
    /**
     * 失败
     */
    private static final int FAILED = 0;
    
    /**
     * 错误
     */
    private static final int ERROR = -1;
    
    
    /**
     * 操作
     */
    private String op ;
	
	/**
     * 执行结果  1:成功  0：失败  -1：错误
     */
	private int result_code = 1;
	
	/**
	 * 消息
	 */
	private String msg = SUCCESS_MSG;
    
    /**
     * APP结果
     */
    private Object result ;
    
    public void success(String msg){
    	result_code = SUCCESS;
    	this.msg = msg;
    }
    
    public void failed(String msg){
    	result_code = FAILED;
    	this.msg = msg;
    }
    
    public void error(String msg){
    	result_code = ERROR;
    	this.msg = msg;
    }
    
    public void error(int code,String msg){
    	result_code = code;
    	this.msg = msg;
    }
    
    public AppJsonResponse(String op){
    	this.op = op;
    }

	public String getOp() {
		return op;
	}

	public void setOp(String op) {
		this.op = op;
	}

	public int getResult_code() {
		return result_code;
	}

	public void setResult_code(int result_code) {
		this.result_code = result_code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public void setResult(Object result) {
		this.result = result;
	}
    
	public Object getResult() {
		return result;
	}
    
}
